<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"
            type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            // var token="Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxYzliNjI4NS1mMzI1LTQ4ZjMtYmY0NS00ZDAxYWY2NTAyYzMiLCJleHAiOjE1OTg5NTAyMDAsImNyZWF0ZWQiOjE1OTg5NDMwNDk5NzQsImp0aSI6IjNhOGRkNzU1LTJkNTEtNGYyYi1iYWZmLWU3MWIyMGYxYTkzMyJ9.jJI_z1ekNyc4bUa2WUQR4RuK9nU1O8BENeZA09odNMQ"
            $("#btn_ajax").click(function () {
                console.info("Ajax请求")
                $.ajax({
                    type: "POST",
                    url: 'http://localhost:8641/business/singleServer/querySingleTB',
                    data: {
                        serviceID: "xm01_singleTable_PQFU",
                        pageNO: "1",
                        pageSize: "10"
                    },
                    dataType: 'json',
                    async: false,
                    // contentType:'application/json;charset=UTF-8',
                    beforeSend: function (request) {
                        console.log("Token:" + $("#token").val())
                        request.setRequestHeader("Authorization", $("#token").val());
                    },
                    success: function (res) {
                        if (res) {
                            console.log(res)
                            console.log("请求成功")
                        } else {
                            console.log("请求失败")
                        }
                    }
                });
            });
        })
    </script>
</head>
<body>
<p>Token</p>
<input class="form-control" id="token" placeholder="输入Token" type="text">
<button id="btn_ajax" class="btn blue-steel">
    Ajax请求
</button>
</body>
</html> 